package com.week3.day03.homework1;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class StrDecomposition {
    public HashMap<String, Integer> strDec(String str) {
        HashMap<String, Integer> map = new HashMap<>();
        for (int i = 0; i < str.length(); i++) {
            String key = String.valueOf(str.charAt(i));
            if (!key.equals(" ")) {
                if (map.containsKey(key)) {
                    map.put(key, map.get(key) + 1);
                } else {
                    map.put(key, 1);
                }
            }
        }
        return map;
    }
}
